package com.itshi.demo1;

/**
 * @author げっしょく
 * @date 2021/7/5
 */
public class demo4 {
    public static void main(String[] args) {
        int arr[] = {789,250,1438,414};
        int[] MinAndMax = getMinAndMax(arr);
        System.out.println(MinAndMax[0]);
        System.out.println(MinAndMax[1]);
    }
    public static int[] getMinAndMax(int[] arr){
        int max = arr[0];
        int min = arr[0];
        for (int i = 0; i < arr.length; i++) {
            if(min>arr[i])
                min = arr[i];
            if(max< arr[i])
                max = arr[i];
        }
        int[] MinAndMax = {min , max};
        return MinAndMax;
    }


}
/*   System.out.print("[");
        for (int i = 0; i < num.length; i++) {
            if(i != num.length-1){
                System.out.print(num[i]+", ");
            }else{
                System.out.println(num[i]+"]");
            }
        }
    }
    public static void main(String[] args) {
        int[] num = {11,22,33,44,55};
        shat(num);
        System.out.println(num);
    }

 */